{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Disproportionate effects of COVID-19 on majority African American communities in the U.S." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Author: Rachel Smith" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "COVID-19 has been dominating our thoughts, our lives, and the news for months now. As this deadly pandemic ravages the world, the news have been reporting that racial disparities have deadly implications for African Americans. Reports suggest an overrepresentation of infections, hospitalizations, and deaths for African Americans compared to their white counterparts. This is unsuprising for countless reasons, but I wanted to dig into the data for myself. There are many different ways to approach this analysis, but for simplicity's sake, I use data reporting COVID-related deaths by county and match that to 2010 US census data reporting racial demographics by county. Here, I show data demonstrating that majority black communities are being disproportinately affected by COVID-19." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Install and import packages" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "#pip install chart_studio" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "#pip install \"notebook>=5.3\" " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#pip install ptitprince" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "from datetime import datetime as dt\n", "import seaborn as sns\n", "import chart_studio\n", "import chart_studio.plotly as py\n", "import plotly\n", "import plotly.graph_objs as go\n", "import plotly.express as px\n", "import plotly.io as pio\n", "import ptitprince as pt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Task 1: Explore COVID-19 deaths data. How have COVID deaths been progressing state-wise? How are these deaths distributed across counties?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Load data" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "url = \"https://usafactsstatic.blob.core.windows.net/public/data/covid-19/covid_deaths_usafacts.csv\"\n", "df_us_deaths = pd.read_csv(url)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Link to data: https://usafacts.org/visualizations/coronavirus-covid-19-spread-map/\n", "\n", "The data I will be using to show COVID-19 death rates comes from USAFacts.org. USAFacts lists cumulative deaths in each county in each state of the US starting 1/22/20, and includes state and county FIPS. These codes will come in handy later for merging dataframes. USAFacts also has separate data sets for confirmed cases and population adjustments. I will be using confirmed deaths as a metric for severity, and conducting my own county-based population adjustments." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Explore & format data" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
| \n", " | countyFIPS | \n", "County Name | \n", "State | \n", "stateFIPS | \n", "1/22/20 | \n", "1/23/20 | \n", "1/24/20 | \n", "1/25/20 | \n", "1/26/20 | \n", "1/27/20 | \n", "... | \n", "4/25/20 | \n", "4/26/20 | \n", "4/27/20 | \n", "4/28/20 | \n", "4/29/20 | \n", "4/30/20 | \n", "5/1/20 | \n", "5/2/20 | \n", "5/3/20 | \n", "5/4/20 | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "Statewide Unallocated | \n", "AL | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
| 1 | \n", "1001 | \n", "Autauga County | \n", "AL | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "... | \n", "2 | \n", "2 | \n", "3 | \n", "3 | \n", "3 | \n", "3 | \n", "3 | \n", "3 | \n", "3 | \n", "3 | \n", "
| 2 | \n", "1003 | \n", "Baldwin County | \n", "AL | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "... | \n", "2 | \n", "2 | \n", "2 | \n", "2 | \n", "2 | \n", "3 | \n", "4 | \n", "4 | \n", "4 | \n", "4 | \n", "
| 3 | \n", "1005 | \n", "Barbour County | \n", "AL | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "1 | \n", "1 | \n", "1 | \n", "1 | \n", "1 | \n", "
| 4 | \n", "1007 | \n", "Bibb County | \n", "AL | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
5 rows × 108 columns
\n", "| \n", " | County,State | \n", "total_res | \n", "Deaths | \n", "percent_death | \n", "Race | \n", "Num_res | \n", "percent_race | \n", "
|---|---|---|---|---|---|---|---|
| 0 | \n", "Autauga County, AL | \n", "54434 | \n", "3 | \n", "0.00551 | \n", "American Indian | \n", "468 | \n", "0.86 | \n", "
| 1 | \n", "Autauga County, AL | \n", "54434 | \n", "3 | \n", "0.00551 | \n", "Asian | \n", "649 | \n", "1.19 | \n", "
| 2 | \n", "Autauga County, AL | \n", "54434 | \n", "3 | \n", "0.00551 | \n", "Black | \n", "9813 | \n", "18.03 | \n", "
| 3 | \n", "Autauga County, AL | \n", "54434 | \n", "3 | \n", "0.00551 | \n", "Hispanic | \n", "1310 | \n", "2.41 | \n", "
| 4 | \n", "Autauga County, AL | \n", "54434 | \n", "3 | \n", "0.00551 | \n", "White | \n", "42194 | \n", "77.51 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 15666 | \n", "Weston County, WY | \n", "7203 | \n", "0 | \n", "0.00000 | \n", "American Indian | \n", "155 | \n", "2.15 | \n", "
| 15667 | \n", "Weston County, WY | \n", "7203 | \n", "0 | \n", "0.00000 | \n", "Asian | \n", "30 | \n", "0.42 | \n", "
| 15668 | \n", "Weston County, WY | \n", "7203 | \n", "0 | \n", "0.00000 | \n", "Black | \n", "36 | \n", "0.50 | \n", "
| 15669 | \n", "Weston County, WY | \n", "7203 | \n", "0 | \n", "0.00000 | \n", "Hispanic | \n", "216 | \n", "3.00 | \n", "
| 15670 | \n", "Weston County, WY | \n", "7203 | \n", "0 | \n", "0.00000 | \n", "White | \n", "6766 | \n", "93.93 | \n", "
15671 rows × 7 columns
\n", "| \n", " | County,State | \n", "total_res | \n", "Deaths | \n", "percent_death | \n", "Race | \n", "Num_res | \n", "percent_race | \n", "
|---|---|---|---|---|---|---|---|
| 1594 | \n", "Washington, DC | \n", "596960 | \n", "258 | \n", "0.04322 | \n", "American Indian | \n", "1992 | \n", "0.33 | \n", "
| 1595 | \n", "Washington, DC | \n", "596960 | \n", "258 | \n", "0.04322 | \n", "Asian | \n", "24755 | \n", "4.15 | \n", "
| 1596 | \n", "Washington, DC | \n", "596960 | \n", "258 | \n", "0.04322 | \n", "Black | \n", "305075 | \n", "51.10 | \n", "
| 1597 | \n", "Washington, DC | \n", "596960 | \n", "258 | \n", "0.04322 | \n", "Hispanic | \n", "54749 | \n", "9.17 | \n", "
| 1598 | \n", "Washington, DC | \n", "596960 | \n", "258 | \n", "0.04322 | \n", "White | \n", "210389 | \n", "35.24 | \n", "